package com.smart.mapper;

import com.smart.pojo.Produce;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.smart.resp.EchartsData;
import com.smart.resp.ProduceResp;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author lyj
 * @since 2023-05-14
 */
public interface ProduceMapper extends BaseMapper<Produce> {

    @Select("select pe.*,pt.name productName\n" +
            "from produce pe,\n" +
            "product pt\n" +
            "where pe.product_id=pt.id " +
            "and pe.del_flag=0")
    List<ProduceResp> queryAll();

    @Select("select pt.name name,\n" +
            "pe.quantity value\n" +
            "from produce pe,product pt\n" +
            "where pe.del_flag=0\n" +
            "and pt.del_flag=0\n" +
            "and pe.product_id=pt.id\n" +
            "and pe.status=1")
    List<EchartsData> getPlanData();
}
